package cn.earl.springboot.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.NotBlank;

import com.alibaba.fastjson.annotation.JSONField;

/**
 * 评论
 * 
 * @author ASUS-A455L
 *
 */
@Entity
@Table(name = "tb_comment")
public class Comment {

	@Id
	@GeneratedValue
	private int id;

	// 用户id
	@OneToOne(targetEntity = User.class)
	@JoinColumn(name = "user_id")
	private int user_id;

	// 帖子id
	@ManyToOne(targetEntity = Post.class)
	@JoinColumn(name = "post_id")
	private int post_id;

	// 内容
	@NotBlank
	private String content;

	// 评论时间
	@JSONField(format = Global.DATE_FORMAT)
	private Date comment_time;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getUser_id() {
		return user_id;
	}

	public void setUser_id(int user_id) {
		this.user_id = user_id;
	}

	public int getPost_id() {
		return post_id;
	}

	public void setPost_id(int post_id) {
		this.post_id = post_id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getComment_time() {
		return comment_time;
	}

	public void setComment_time(Date comment_time) {
		this.comment_time = comment_time;
	}

}
